package com.fary.api;

import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import static com.fary.util.TaskBean.executeTaskService;

/**
 * 通过接口立即执行定时任务
 */
@Slf4j
@RestController
@RequestMapping("/task")
public class ExecuteTaskApi {

    @GetMapping("/execute")
    public String doExecuteTask(@RequestParam String cornId) {
        executeTaskService.doExecuteTask(cornId);
        return "执行成功！";
    }
}
